import 'package:gluz/generated/json/base/json_convert_content.dart';
import 'package:gluz/app/data/country_entity.dart';
import 'package:get/get.dart';


CountryEntity $CountryEntityFromJson(Map<String, dynamic> json) {
  final CountryEntity countryEntity = CountryEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    countryEntity.code = code;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    countryEntity.name = name;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    countryEntity.image = image;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    countryEntity.id = id;
  }
  return countryEntity;
}

Map<String, dynamic> $CountryEntityToJson(CountryEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['name'] = entity.name;
  data['image'] = entity.image;
  data['id'] = entity.id;
  return data;
}

extension CountryEntityExtension on CountryEntity {
  CountryEntity copyWith({
    String? code,
    String? name,
    String? image,
    int? id,
  }) {
    return CountryEntity()
      ..code = code ?? this.code
      ..name = name ?? this.name
      ..image = image ?? this.image
      ..id = id ?? this.id;
  }
}